'use strict';
const db = uniCloud.database()
const collection = db.collection('houselist')
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	const {pageNum, pageSize} = event
	const startNum  = (pageNum - 1) * pageSize
	const {data} = await collection.skip(startNum).limit(pageSize).get()  // {data: []}
	const {total} = await collection.count()
	
	//返回数据给客户端
	return {
		data,
		total
	}
};
